<template>
  <div>
      <el-row>
          <el-col id="KeyDriverInfo" :span="10">
               <!-- <table class="userInfoEditTable" style="border-collapse:collapse;background-color:white;" width="100%" cellspacing="0">
                   <tr v-for="(v,k,i) in form" :key="v">
                      <template v-if="k!=='sex'">
                       <td class="tb_label">{{labels[i]}}</td>
                       <td>
                           {{v}}
                       </td>
                      </template>
                      <template v-else>
                        <td class="tb_label">{{labels[i]}}</td>
                       <td>
                           {{v==1?'男':'女'}}
                       </td>
                      </template>
                     </tr>
                    <tr>
                      <td colspan="2" align="center">
                        <el-button type="text" size="large" @click="printTable('KeyDriverInfo')">[打印]</el-button>
                        <el-button type="text" size="large" @click="goBack()">[返回]</el-button>
                      </td>
                  </tr>
               </table> -->

          </el-col>
      </el-row>
  </div>
</template>

<script>
import * as api from '@/api/trafficManage'
// 基本表格组件
import BaiscInfoTable from "../../components/InfoTemplate";
export default {
  components:{
    BaiscInfoTable:BaiscInfoTable
  },
  data(){
      return{
        form: {
            keyDriverID: "1", //          bigint,
            keyDriverName: "张三丰", //        varchar(50),
            certifID: "3456", //             char(18) not null comment '身份证号. 编码应符合GB 11643',
            sex: 1, //                  char(1) comment '1=男性；0=女性，编码应符合 GB/T 2261.1',
            contact: "189xxxxxx", //              varchar(50) comment '联系方式',
            drivingLicenseTypeValue: "02", // char(2) comment '准驾车型',
            homeAddress: "江苏", //          varchar(200) comment '家庭住址',
            netGridID: "1", //            bigint comment '常住地址所在网格',
            enterpriseUSCcode: "123", //    char(18) comment '如果该驾驶员属于某个公司，则填入该公司统一社会信用代码；否则，可不填。',
            remarks: "123" //              varchar(500)
        },
        labels: ["编号","姓名", "身份证号", "性别", "联系方式",'准驾车型','家庭住址',"所属网格","全国统一代码","备注"],
        netGridType: []
      }
  },
  methods:{
    printTable(div){
        var div_print = document.getElementById(div)
        var newStr = div_print.innerHTML
        var oldStr = document.body.innerHTML
        document.body.innerHTML = newStr
        window.print()
        window.location.reload();
        window.body.innerHTML = oldStr
        return false
    },
    goBack(){
      this.$router.go(-1)
    }
  },
  mounted(){
      let id = this.$route.query.id
      api.fetchDetaileByDriverID(id).then(res=>{
          this.form = res.data.detail
      })
  }
}
</script>

<style scoped>
.userInfoEditTable,
.userInfoEditTable td {
  border: 1px solid darkgrey;
  padding: 10px;
}

.tb_label {
  width: 18%;
  text-align: right;
}
</style>
